@import '../../style/themes/index';
@import './mixin.less';
@import './token.less';

@city-picker-prefix-cls: ~'@{kd-prefix}-city-picker';

.@{city-picker-prefix-cls}-container {
  display: flex;
  flex-direction: column;
  position: relative;
  border-bottom: 1px solid #999;

  .@{city-picker-prefix-cls}-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #999999;
    letter-spacing: 0;
    line-height: 21px;
  }

  .@{city-picker-prefix-cls}-title {
    margin-bottom: 9px;
    font-size: 12px;
    color: #666666;
    letter-spacing: 0;
    line-height: 18px;
  }

  .@{city-picker-prefix-cls}-info {
    margin-right: 20px;
  }

  .@{city-picker-prefix-cls}-input {
    border: 0;
    outline: none;
    flex-grow: 1;
    width: 50%;
    color: #212121;
  }

  .@{city-picker-prefix-cls}-arrow {
    font-size: 16px;
    position: absolute;
    right: 0;
    bottom: 0;
    transition: transform .2s ease;
    &.arrow-up {
      transform: rotate(180deg);
    }
  }
}

.@{city-picker-prefix-cls}-panel-container {
  width: @city-picker-panel-sizing-width;
  height: @city-picker-panel-sizing-height;
  font-size: @city-picker-panel-font-size;
  line-height: 18px;
  letter-spacing: 0;

  .@{city-picker-prefix-cls}-header {
    display: flex;
    align-items: center;
    text-align: center;

    .@{city-picker-prefix-cls}-tab-item {
      position: relative;
      cursor: pointer;
      padding: 3px 0;

      &.active {
        color: @city-picker-theme-color;
        z-index: 1;

        &::before {
          z-index: -1;
          background: #fff;
        }
      }
    }

    .@{city-picker-prefix-cls}-header-domestic {
      width: 94px;
      &::before {
        position: absolute;
        content: '';
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -2;
        background: @city-picker-background-color;
        border-radius: 2px 4px 0 0;
        transform: scaleY(1.25) perspective(18px) rotateX(10deg);
        transform-origin: bottom left;
        box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.2);
      }
    }

    .@{city-picker-prefix-cls}-header-internation {
      width: 108px;
      margin-left: -13px;
      &::before {
        position: absolute;
        content: '';
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -2;
        background: @city-picker-background-color;
        border-radius: 4px 4px 0 0;
        transform: scaleY(1.25) perspective(18px) rotateX(10deg);
        transform-origin: bottom;
        box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.2);
      }
    }
  }
}

.@{city-picker-prefix-cls}-panel-item {
  margin: 4px 6px;
  padding: 3px 6px;
  color: #212121;
  width: 72px;
  cursor: pointer;

  &:hover {
    background: @city-picker-background-hover-color;
    border-radius: 2px;
  }
}

.@{city-picker-prefix-cls}-content-container {
  height: 349px;
  padding: 0 20px 12px 20px;
  background: #fff;
  box-shadow: 0 1px 6px 0 rgba(0, 0, 0, 0.2);
  border-radius: 0 @city-picker-panel-radius-border @city-picker-panel-radius-border @city-picker-panel-radius-border;
}

.@{city-picker-prefix-cls}-group-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.@{city-picker-prefix-cls}-group-item {
  flex-grow: 1;
  flex-shrink: 1;
  padding: 10px 0;
  max-height: 39px;
  box-sizing: border-box;
  border-bottom: 2px solid #F5F5F5;
  cursor: pointer;
  text-align: center;

  &:hover {
    color: @city-picker-theme-color;
  }

  &.active {
    color: @city-picker-theme-color;
    border-bottom: 2px solid @city-picker-theme-color;
  }

  &.last {
    flex-shrink: 1;
  }
}

.@{city-picker-prefix-cls}-city-table {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
  max-height: ~'calc(100% - 39px - 10px)';
  overflow: scroll;

  .@{city-picker-prefix-cls}-city-table-group {
    display: flex;

    .@{city-picker-prefix-cls}-city-table-key {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      color: #999;
      margin-right: 32px;
      flex-shrink: 0;
      flex-grow: 0;
    }
  }

  .@{city-picker-prefix-cls}-city-table-item-container {
    display: flex;
    flex-wrap: wrap;
  }

  .@{city-picker-prefix-cls}-city-table-cell {
    margin: 4px 6px;
    padding: 3px 6px;
    color: @city-picker-panel-item-color;
    cursor: pointer;
    width: 60px;
    overflow: hidden;
    white-space: nowrap;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;

    &:hover {
      background: @city-picker-background-hover-color;
      border-radius: 2px;
    }
  }
}

.@{city-picker-prefix-cls}-search-panel {
  display: flex;
  flex-direction: column;
  width: 256px;
  height: 320px;
  padding: 8px 0;
  font-size: 12px;
  color: #212121;
  letter-spacing: 0;
  line-height: 18px;
  overflow: scroll;
  box-shadow: 0 4px 10px 0 rgba(0,0,0,0.20);
  border-radius: 2px;
  background: #fff;

  .@{city-picker-prefix-cls}-search-panel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 8px;
    cursor: pointer;

    &:hover {
      background: @city-picker-background-hover-color;
    }

    .@{city-picker-prefix-cls}-search-panel-item-left {
      overflow: hidden;
      white-space: nowrap;
      -o-text-overflow: ellipsis;
      text-overflow: ellipsis;
      flex-grow: 0;
      flex-shrink: 0;
      max-width: 168px;
    }

    .@{city-picker-prefix-cls}-search-panel-item-right {
      flex-grow: 0;
      flex-shrink: 0;
      max-width: 112px;
      overflow: hidden;
      white-space: nowrap;
      -o-text-overflow: ellipsis;
      text-overflow: ellipsis;
      text-align: right;
      color: #999999;
    }
  }
}

.@{city-picker-prefix-cls}-search-keyword {
  color: @city-picker-theme-color;
}

.@{city-picker-prefix-cls}-no-data {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
